# Author:sp
# CreaTime: $(DATE)
# FileName: $(NAME)
# Description: simple introdution of the code
class Student():
    def __init__(self,name,age):
        self.name=name
        self.age=age
    def __str__(self):              #重写父类的方法
        #print(f'{self.name}已经{self.age}岁了')      #TypeError: __str__ returned non-string (type NoneType)
        return(f'{self.name}已经{self.age}岁了')
stu=Student('张三',20)
print(dir(stu))
print(stu)              #默认调用__str__()这样的方法
